<template>
  <div class="userMain">
    <a-row>
      <a-col :span="6"></a-col>
      <a-col :span="12">
        <a-form-model :label-col="labelCol" :wrapper-col="wrapperCol" class="formVideoModel">
          <a-form-model-item label="姓名">
            <a-input v-model="info.name" :read-only="readonly"/>
          </a-form-model-item>
           <a-form-model-item label="联系电话">
            <a-input v-model="info.mobile" :read-only="readonly" />
          </a-form-model-item>
          <a-form-model-item label="岗位名称">
            <a-input v-model="info.deptName" :read-only="readonly" />
          </a-form-model-item>
          <a-form-model-item label="登陆账号">
             <a-input v-model="info.account" :read-only="readonly" />
          </a-form-model-item>
           <a-form-model-item label="归属">
            <a-input v-model="info.belong" :read-only="readonly" />
          </a-form-model-item>
           <a-form-model-item label="人员类型">
             <a-input v-model="info.type" :read-only="readonly" />
          </a-form-model-item>
           <a-form-model-item label="角色">
             <a-input v-model="info.roleName" :read-only="readonly" />
          </a-form-model-item>
          <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
            <!-- <a-button type="primary" @click="onSubmit">
              提交
            </a-button> -->
          </a-form-model-item>
        </a-form-model>
      </a-col>
      <a-col :span="6"></a-col>
    </a-row>
  </div>
</template>

<script>
import { modifyAccountPwd, getMemberInfo } from '@/api/public'
import Vue from 'vue'
export default {
  name: 'UserMenu',
  components: {},
  computed: {},
  created() {
    getMemberInfo().then(response => {
      this.info = response.data
  
    })
  },
  mounted() {},
  data() {
    return {
      info: { },
      account: '',
      newpwd: '',
      againpwd: '',
      diasabledInput: true,
      labelCol: { span: 4 },
      wrapperCol: { span: 14 },
      readonly: true,
    }
  },
  methods: {
    onSubmit() {
      if (this.info.newpwd.length == 0 || this.info.againpwd.length == 0) {
        let type = 'error'
        this.$notification[type]({
          message: '温馨提示',
          description: '请输入密码！',
          duration: 3
        })
        return
      }
      if (this.info.newpwd != this.info.againpwd) {
        let type = 'error'
        this.$notification[type]({
          message: '温馨提示',
          description: '两次输入的密码不一致!',
          duration: 3
        })
        return
      }
      let datainfo = {}
      datainfo.account = this.account
      datainfo.password = this.info.newpwd
      modifyAccountPwd(datainfo).then(response => {
        const code = response.data.code
        if (code == 200) {
          let type = 'success'
          this.$notification[type]({
            message: '温馨提示',
            description: '修改密码成功!',
            duration: 3
          })
          Vue.ls.clear()
          this.$router.push({ name: 'login' })
        } else {
          let type = 'error'
          this.$notification[type]({
            message: '温馨提示',
            description: '修改密码失败!',
            duration: 3
          })
        }
      })
    }
  }
}
</script>
<style scoped>
.menubutton {
  margin-right: 20px;
}
.comTitle {
  display: inline;
  margin-right: 250px;
  font-size: 23px;
  font-weight: 600;
}
.iconPosition {
  position: absolute;
  z-index: 111;
  top: 22px;
  right: 15%;
}
.userMain {
  min-height: 900px;
}

</style>
